package adv4;

import java.util.*;

/**
 * @author oldliu
 * @since 1.0
 */
public class HomeWork1 {
    public static void main(String[] args) {

        Map<String,String> map = new HashMap<>();
        map.put("狗","Dog");
        map.put("猫","Cat");
        map.put("猪","Pig");
        map.put("羊","Sheep");
        map.put("鸡","Chicken");
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入英文：");
        //通过value 找到key
        String value = sc.next();
        //迭代
        Set<Map.Entry<String, String>> er = map.entrySet();
        Iterator<Map.Entry<String, String>> ir = er.iterator();
        while (ir.hasNext()){
            Map.Entry<String, String> e = ir.next();
            if (e.getValue().equals(value)) {
                System.out.println(e.getKey());
            }
        }
    }
}
